<template>
  <div class="login">
    <h2 style="text-align: center;margin: 60rpx auto;font-size: 64rpx;">确认登录吗</h2>
    <button type="primary" @click="submitLogin">确 认</button>
  </div>
</template>

<script>
  export default {
    data() {
      return {
        uuid: "",
      }
    },
    onLoad(option) {
      this.uuid = option.uuid;
    },
    methods: {
      submitLogin() {
		  console.log(uni.getStorageSync('userInfo'));
        uni.request({
          url: `http://192.168.204.211:3000/scanQRcodeLogin`,
          method: 'POST',
          data: {
            uuid: this.uuid,
            userId: uni.getStorageSync('userInfo').userId
          },
          success: (res) => {
            if (res.data.status == 404) {
              uni.showToast({
                title: res.data.msg,
                icon: 'none',
                duration: 2000
              });
            } else {
              uni.showToast({
                title: res.data.msg,
                icon: 'none',
                duration: 3000
              });
			  uni.navigateBack();
            }
          }
        });
      }
    }
  }
</script>

<style scoped>
  .login {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20% 0;
    text-align: center;
    flex-direction: column;
  }
  h2 {
    margin-bottom: 20px;
  }
</style>
